package com.doctor.windflower_doctor.pop;

import android.graphics.Bitmap;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import com.doctor.windflower_doctor.R;
import com.doctor.windflower_doctor.SystemApplication;
import com.doctor.windflower_doctor.activity.BaseActivity;
import com.doctor.windflower_doctor.util.StringUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;

public class BigImagePopWindow extends BasePopupWindow implements OnClickListener {
	private ImageView big_imageview;
	private String url;
	private RelativeLayout big_img_pop;
	private DisplayImageOptions options;

	public BigImagePopWindow(BaseActivity act, String url) {
		super(act, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		this.url = url;
	}

	@Override
	protected void onShowPre() {
		options = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.loading_img).showImageOnFail(R.drawable.list_default_icon)
				.showImageForEmptyUri(R.drawable.list_default_icon).cacheInMemory(true).cacheOnDisk(true).bitmapConfig(Bitmap.Config.ARGB_8888).build();
		big_imageview.setImageBitmap(null);
		if (!StringUtil.isEmpty(url)) {
			SystemApplication.getInstance().mImageLoad1.displayImage(url, big_imageview, options);
		}
		super.onShowPre();
	}

	@Override
	protected void setListener() {
		big_img_pop.setOnClickListener(this);
	}

	@Override
	protected void findViews() {
		big_imageview = (ImageView) findViewById(R.id.big_imageview);
		big_img_pop = (RelativeLayout) findViewById(R.id.big_img_pop);
	}

	@Override
	protected int getContentViewLayoutId() {
		// TODO Auto-generated method stub
		return R.layout.pop_view_big_img;
	}

	@Override
	protected void initViewDrawableSelectCache() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void onItemClick(View view, PopupWindow pop) {
		switch (view.getId()) {

		case R.id.big_img_pop:
			pop.dismiss();
			break;
		}
	}

}
